package com.ruoyi.hotel.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.hotel.domain.LyhmsRoomType;
import com.ruoyi.hotel.mapper.LyhmsRoomTypeMapper;
import com.ruoyi.hotel.service.ILyhmsRoomTypeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
 * Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-02-28
 */
@Service
public class LyhmsRoomTypeServiceImpl implements ILyhmsRoomTypeService
{
    @Resource
    private LyhmsRoomTypeMapper lyhmsRoomTypeMapper;

    /**
     * 查询
     * 
     * @param id 主键
     * @return
     */
    @Override
    public LyhmsRoomType selectLyhmsRoomTypeById(Long id)
    {
        return lyhmsRoomTypeMapper.selectLyhmsRoomTypeById(id);
    }

    /**
     * 查询列表
     * 
     * @param lyhmsRoomType
     * @return
     */
    @Override
    public List<LyhmsRoomType> selectLyhmsRoomTypeList(LyhmsRoomType lyhmsRoomType)
    {
        return lyhmsRoomTypeMapper.selectLyhmsRoomTypeList(lyhmsRoomType);
    }

    /**
     * 新增
     * 
     * @param lyhmsRoomType
     * @return 结果
     */
    @Override
    public int insertLyhmsRoomType(LyhmsRoomType lyhmsRoomType)
    {
        long deptId = SecurityUtils.getCurrentDeptId();
        lyhmsRoomType.setDeptId(deptId);
        lyhmsRoomType.setCreateTime(DateUtils.getNowDate());
        return lyhmsRoomTypeMapper.insertLyhmsRoomType(lyhmsRoomType);
    }

    /**
     * 修改
     * 
     * @param lyhmsRoomType
     * @return 结果
     */
    @Override
    public int updateLyhmsRoomType(LyhmsRoomType lyhmsRoomType)
    {
        return lyhmsRoomTypeMapper.updateLyhmsRoomType(lyhmsRoomType);
    }

    /**
     * 批量删除
     * 
     * @param ids 需要删除的主键
     * @return 结果
     */
    @Override
    public int deleteLyhmsRoomTypeByIds(Long[] ids)
    {
        return lyhmsRoomTypeMapper.deleteLyhmsRoomTypeByIds(ids);
    }

    /**
     * 删除信息
     * 
     * @param id 主键
     * @return 结果
     */
    @Override
    public int deleteLyhmsRoomTypeById(Long id)
    {
        return lyhmsRoomTypeMapper.deleteLyhmsRoomTypeById(id);
    }

    @Override
    public LyhmsRoomType selectLyhmsRoomTypeByName(String type) {
        return lyhmsRoomTypeMapper.selectLyhmsRoomTypeByName(type);
    }
}
